package routes

import (
	"github.com/gin-gonic/gin"
	api "github.com/spectacleCase/develop_auth_platform/api/v1"
)

func NewRouter() *gin.Engine {

	r := gin.Default()
	v1 := r.Group("api/v1")

	{
		v1.GET("ping", func(c *gin.Context) {
			c.JSON(200, gin.H{"message": "测试成功"})
		})
	}

	v1.Group("/application/app").
		GET("", api.Application{}.Get()).
		POST("", api.Application{}.Create()).
		PUT("", api.Application{}.Update()).
		DELETE("", api.Application{}.Delete())

	v1.Group("/application/test").
		POST("", api.Test{}.Verify())

	return r
}
